n = int(input())
if 1000 <= n <= 9999:
    d = 0
    for i range(2 , n)
    if n % 1 ==0:
        d += 1
    if d == 0:
        print(n)
    else:
        print(0)
else:
    print(0)